package com.yvon.grpc.api;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.30.2)",
    comments = "Source: calculate.proto")
public final class CalculateServiceGrpc {

  private CalculateServiceGrpc() {}

  public static final String SERVICE_NAME = "CalculateService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.yvon.grpc.api.CalculateProto.Value,
      com.yvon.grpc.api.CalculateProto.Result> getGetResultMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "getResult",
      requestType = com.yvon.grpc.api.CalculateProto.Value.class,
      responseType = com.yvon.grpc.api.CalculateProto.Result.class,
      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
  public static io.grpc.MethodDescriptor<com.yvon.grpc.api.CalculateProto.Value,
      com.yvon.grpc.api.CalculateProto.Result> getGetResultMethod() {
    io.grpc.MethodDescriptor<com.yvon.grpc.api.CalculateProto.Value, com.yvon.grpc.api.CalculateProto.Result> getGetResultMethod;
    if ((getGetResultMethod = CalculateServiceGrpc.getGetResultMethod) == null) {
      synchronized (CalculateServiceGrpc.class) {
        if ((getGetResultMethod = CalculateServiceGrpc.getGetResultMethod) == null) {
          CalculateServiceGrpc.getGetResultMethod = getGetResultMethod =
              io.grpc.MethodDescriptor.<com.yvon.grpc.api.CalculateProto.Value, com.yvon.grpc.api.CalculateProto.Result>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getResult"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yvon.grpc.api.CalculateProto.Value.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.yvon.grpc.api.CalculateProto.Result.getDefaultInstance()))
              .setSchemaDescriptor(new CalculateServiceMethodDescriptorSupplier("getResult"))
              .build();
        }
      }
    }
    return getGetResultMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static CalculateServiceStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<CalculateServiceStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<CalculateServiceStub>() {
        @java.lang.Override
        public CalculateServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new CalculateServiceStub(channel, callOptions);
        }
      };
    return CalculateServiceStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static CalculateServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<CalculateServiceBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<CalculateServiceBlockingStub>() {
        @java.lang.Override
        public CalculateServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new CalculateServiceBlockingStub(channel, callOptions);
        }
      };
    return CalculateServiceBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static CalculateServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<CalculateServiceFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<CalculateServiceFutureStub>() {
        @java.lang.Override
        public CalculateServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new CalculateServiceFutureStub(channel, callOptions);
        }
      };
    return CalculateServiceFutureStub.newStub(factory, channel);
  }

  /**
   */
  public static abstract class CalculateServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Value> getResult(
        io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result> responseObserver) {
      return asyncUnimplementedStreamingCall(getGetResultMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getGetResultMethod(),
            asyncBidiStreamingCall(
              new MethodHandlers<
                com.yvon.grpc.api.CalculateProto.Value,
                com.yvon.grpc.api.CalculateProto.Result>(
                  this, METHODID_GET_RESULT)))
          .build();
    }
  }

  /**
   */
  public static final class CalculateServiceStub extends io.grpc.stub.AbstractAsyncStub<CalculateServiceStub> {
    private CalculateServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected CalculateServiceStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new CalculateServiceStub(channel, callOptions);
    }

    /**
     */
    public io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Value> getResult(
        io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result> responseObserver) {
      return asyncBidiStreamingCall(
          getChannel().newCall(getGetResultMethod(), getCallOptions()), responseObserver);
    }
  }

  /**
   */
  public static final class CalculateServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<CalculateServiceBlockingStub> {
    private CalculateServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected CalculateServiceBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new CalculateServiceBlockingStub(channel, callOptions);
    }
  }

  /**
   */
  public static final class CalculateServiceFutureStub extends io.grpc.stub.AbstractFutureStub<CalculateServiceFutureStub> {
    private CalculateServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected CalculateServiceFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new CalculateServiceFutureStub(channel, callOptions);
    }
  }

  private static final int METHODID_GET_RESULT = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final CalculateServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(CalculateServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_GET_RESULT:
          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.getResult(
              (io.grpc.stub.StreamObserver<com.yvon.grpc.api.CalculateProto.Result>) responseObserver);
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class CalculateServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    CalculateServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.yvon.grpc.api.CalculateProto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("CalculateService");
    }
  }

  private static final class CalculateServiceFileDescriptorSupplier
      extends CalculateServiceBaseDescriptorSupplier {
    CalculateServiceFileDescriptorSupplier() {}
  }

  private static final class CalculateServiceMethodDescriptorSupplier
      extends CalculateServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    CalculateServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (CalculateServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new CalculateServiceFileDescriptorSupplier())
              .addMethod(getGetResultMethod())
              .build();
        }
      }
    }
    return result;
  }
}
